<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>

		<div id="app">
			加数1：<input type="number" v-model="num1"/>
			<br>
			加数2：<input type="number" v-model="num2" @keyup.enter="add" />
			<button @click="add">计算：</button> 
			<br>
			总数：<span v-text="count"></span>
		</div>

		<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
		<script>
			const app = new Vue({
				el: "#app",
				data: {
					num1: '',
					num2: '',
					count: ''

				},
				methods: {
					add() {
						//将字符串转换为int
						this.count=parseInt(this.num1)+parseInt(this.num2)
					}

				}

			})
		</script>

	</body>
</html>
